import 'package:app/shared/constants/common.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:get/get.dart';

class SearchWidget extends StatefulWidget {
  SearchWidget({Key? key}) : super(key: key);

  @override
  _SearchWidgetState createState() => _SearchWidgetState();
}

class _SearchWidgetState extends State<SearchWidget> {
  @override
  Widget build(BuildContext context) {
    return Container(
      child: Row(
        children: [
          Container(
            height: 48,
            width: MediaQuery.of(context).size.width - 90,
            margin: EdgeInsets.symmetric(vertical: sDefaultMarginPadding * 2),
            decoration: BoxDecoration(
              borderRadius: BorderRadius.circular(sDefaultMarginPadding * 4),
              color: Color.fromRGBO(238, 238, 238, 1),
            ),
            child: Row(
              mainAxisAlignment: MainAxisAlignment.start,
              children: [
                Container(
                  margin: EdgeInsets.only(
                      left: sDefaultMarginPadding * 1.5,
                      right: sDefaultMarginPadding),
                  child: SvgPicture.asset(
                    'assets/icons/search.svg',
                    height: 30,
                    fit: BoxFit.fitHeight,
                    color: Colors.grey,
                  ),
                ),
                Expanded(
                  child: TextField(
                    readOnly: true,
                    style: TextStyle(fontSize: 14),
                    decoration: InputDecoration(
                      hintText: "关于立冬",
                      border: InputBorder.none,
                    ),
                  ),
                ),
              ],
            ),
          ),
          Expanded(
              child: IconButton(
                  onPressed: () {
                    Get.toNamed("/scan_screen");
                  },
                  icon: Icon(Icons.qr_code_scanner_rounded)))
        ],
      ),
    );
  }
}
